home *** CD-ROM | disk | FTP | other *** search
- /*
- * DOCYCLEBUTTON.C
- */
-
- #include "newlook.h"
-
- extern LONG IntuiTextLength(struct IntuiText *);
- extern UWORD AddGadget( struct Window *, struct Gadget *, UWORD );
- extern VOID RefreshGList( struct Gadget *, struct Window *, struct Requester *, UWORD );
-
- void DoCycleButton(w,g)
- struct Window *w;
- struct Gadget *g;
- {
- if(w && g && g->UserData)
- {
- USHORT pos= RemoveGadgetSafely(w,g);
- struct CycleInfo *ci= (struct CycleInfo *)g->UserData;
- struct IntuiText *it= ci->ci_IntuiText;
-
- if(!(it->IText=ci->ci_Items[++ci->ci_CurrentIndex]))
- it->IText= ci->ci_Items[ci->ci_CurrentIndex=0];
- it->LeftEdge= (g->Width+21-IntuiTextLength(it))/2;
-
- if(pos!=0xFFFF) /* 0xFFFF == (-1) did we really remove the gadget? */
- AddGadget(w,g, pos);
- RefreshGList(g,w,NULL,1L);
- }
- }
-